from django.db import models
from datetime import datetime

# Create your models here.


# other_url记录表
class GetOtherUrl(models.Model):
    id = models.AutoField(primary_key=True)
    other_url = models.CharField(max_length=256, verbose_name='other_url')
    submit_date = models.DateTimeField(verbose_name='提交时间')
    write_date = models.DateTimeField(default = datetime.now(),  verbose_name='存入数据库的时间')

    class Meta:
        db_table = 'get_other_url'


# 文件下载记录表
class DownSuccess(models.Model):
    id = models.AutoField(primary_key=True)
    other_url = models.CharField(max_length=256, verbose_name='other_url')
    write_date = models.DateTimeField(default = datetime.now(),  verbose_name='存入数据库的时间')

    class Meta:
        db_table = 'down_success'


# 下载失败记录表
class DownError(models.Model):
    id = models.AutoField(primary_key=True)
    other_url = models.CharField(max_length=256, verbose_name='other_url')
    write_date = models.DateTimeField(default = datetime.now(),  verbose_name='存入数据库的时间')

    class Meta:
        db_table = 'down_error'


# 解压文件记录表
class UncompressSuccess(models.Model):
    id = models.AutoField(primary_key=True)
    other_url = models.CharField(max_length=256, verbose_name='other_url')
    write_date = models.DateTimeField(default = datetime.now(), verbose_name='存入数据库的时间')

    class Meta:
        db_table = 'uncompress_success'


# 解压失败记录表
class UncompressError(models.Model):
    id = models.AutoField(primary_key=True)
    other_url = models.CharField(max_length=256, verbose_name='other_url')
    write_date = models.DateTimeField(default = datetime.now(), verbose_name='存入数据库的时间')

    class Meta:
        db_table = 'uncompress_error'


# 入库记录表
class WriteSuccess(models.Model):
    id = models.AutoField(primary_key=True)
    other_url = models.CharField(max_length=256, verbose_name='other_url')
    write_date = models.DateTimeField(default = datetime.now(), verbose_name='存入数据库的时间')

    class Meta:
        db_table = 'write_success'


# 入库失败记录表
class WriteError(models.Model):
    id = models.AutoField(primary_key=True)
    other_url = models.CharField(max_length=256, verbose_name='other_url')
    write_date = models.DateTimeField(default = datetime.now(),  verbose_name='存入数据库的时间')

    class Meta:
        db_table = 'write_error'

# 返款金额大于1万
class AmountDetail(models.Model):
    id = models.AutoField(primary_key=True)
    settle_code = models.CharField(max_length=32, verbose_name='结算案编号')
    policy_owner_it_code = models.CharField(max_length=16, verbose_name='itcode')
    other_url = models.CharField(max_length=256, verbose_name='other_url')
    submit_date = models.DateTimeField(verbose_name='提交时间')
    type_name = models.CharField(max_length=256, verbose_name='类型')
    department_name = models.CharField(max_length=256, verbose_name='事业部')
    agent_name = models.CharField(max_length=256, verbose_name='代理商名称')
    total_amount = models.DecimalField(max_digits=12, decimal_places=5, verbose_name='总数')
    budget_code = models.CharField(max_length=256, verbose_name='策划案编号')
    amount = models.DecimalField(max_digits=12, decimal_places=5, verbose_name='数量')
    write_date = models.DateTimeField(default = datetime.now(),  verbose_name='存入数据库的时间')
    class Meta:
        db_table = 'amount_detail'

